$(document).ready(function(){
    jQuery.navlevel2 = function(level1,dytime) {
      $(level1).mouseenter(function(){
		  varthis = $(this);
		  delytime=setTimeout(function(){
			varthis.find('ul').slideDown();
		},dytime);
	  });
	  $(level1).mouseleave(function(){
		 clearTimeout(delytime);
		 $(this).find('ul').slideUp();
	  });
	};
  $.navlevel2("li.mainlevel",100);

/*鼠标经过导航栏隐藏logo*/
/*  $("#nav").mouseover(function(){
  	$("#logo").addClass("logohide");

  });
  $("#nav").mouseout(function(){
  	$("#logo").removeClass("logohide");
  });*/
/*鼠标经过导航栏隐藏logo结束*/

jQuery.actions = function(li,delytime){
  $(li).hover(function(){
		$(this).stop(true).animate({
			fontSize:"16px"
		},delytime);
	}, function(){
		$(this).stop(true).animate({
			
		},delytime);
	});
	};
$.actions("li.cat",100);

});

function g(o){return document.getElementById(o);}
function showdiv(i){
	for(j=1;j<=2;j++){
		g("div"+j).className="hidden";
		g("li"+j).className="";
	}
	g("div"+i).className="show"
	g("li"+i).className="fff"
};

function personalshowdiv(i){
	for(j=1;j<=5;j++){
		g("div"+j).className="hidden";
		g("li"+j).className="";
	}
	g("div"+i).className="show"
	g("li"+i).className="li_on";
}
/*function showdiv1(i){
	for(j=4;j<=6;j++){
		g("div"+j).className="hidden";
		g("li"+j).className="";
	}
	g("div"+i).className="show";
	g("li"+i).className="fff";
}*/

/*大图片滑动结束*/
var t = n = 0, count; 
$(document).ready(function(){
count=$("#slider_list a").length; 
$("#slider_list a:not(:first-child)").hide();
$("#slider_info").html($("#slider_list a:first-child").find("img").attr('alt')); 
$("#slider_info").click(function(){window.open($("#slider_list a:first-child").attr('href'), "_blank")}); 
$("#slider dl").click(function() { 
var i = $(this).text() - 1; 
n = i; 
if (i >= count) return; 
$("#slider_info").html($("#slider_list a").eq(i).find("img").attr('alt')); 
$("#slider_info").unbind().click(function(){window.open($("#slider_list a").eq(i).attr('href'), "_blank")}) 
$("#slider_list a").filter(":visible").fadeOut(300).parent().children().eq(i).fadeIn(300);
$(this).css({"background":"#be2424",'color':'#000'}).siblings().css({"background":"#6f4f67",'color':'#fff'}); 
}); 
t = setInterval("showAuto()", 4000); 
$("#slider").hover(function(){clearInterval(t)}, function(){t = setInterval("showAuto()", 4000);}); 
}) 
function showAuto() 
{ 
n = n >=(count - 1) ? 0 : ++n; 
$("#slider dl").eq(n).trigger('click');
} 
/*大图片滑动结束*/

/*新闻滚动*/
/*$(function() {
		var ticker = $("#ticker");
		ticker.children().filter("dt").each(function() {
		  var dt = $(this),
		    container = $("<div>");
		  dt.next().appendTo(container);
		  dt.prependTo(container);
		  container.appendTo(ticker);
		});
		ticker.css("overflow", "hidden");
		function animator(currentItem) {
		  var distance = currentItem.height();
			duration = (distance + parseInt(currentItem.css("marginTop"))) / 0.025;
		  currentItem.animate({ marginTop: -distance }, duration, "linear", function() {
			currentItem.appendTo(currentItem.parent()).css("marginTop", 0);
			animator(currentItem.parent().children(":first"));
		  }); 
		};
		animator(ticker.children(":first"));
		ticker.mouseenter(function() {
		  ticker.children().stop();
		});
		ticker.mouseleave(function() {
		  animator(ticker.children(":first"));
		});
	  });*/
/*新闻滚动结束*/

/*新闻横向滚动*/
function ScrollImgLeft(){
var speed=20;
var scroll_begin = document.getElementById("scroll_begin");
var scroll_end = document.getElementById("scroll_end");
var scroll_div = document.getElementById("scroll_div");
scroll_end.innerHTML=scroll_begin.innerHTML;
  function Marquee(){
    if(scroll_end.offsetWidth-scroll_div.scrollLeft<=0)
      scroll_div.scrollLeft-=scroll_begin.offsetWidth;
    else
      scroll_div.scrollLeft++;
  }
var MyMar=setInterval(Marquee,30);
  scroll_div.onmouseover=function() {clearInterval(MyMar);}
  scroll_div.onmouseout=function() {MyMar=setInterval(Marquee,speed);}
}
/*新闻横向滚动结束*/

/*学生信息选择框*/
$(function(){
    $(".is_poor").change(function(){
        var is_poor = $(".is_poor option:selected").val();
       if(is_poor == "N"){
            $(".chose_year").fadeOut();
       }else{
            $(".chose_year").fadeIn();
       }
    });
});
/*学生信息选择框结束*/

/*岗位详情页淡入淡出*/

$(function(){
	$("button.job_btn").click(function(){
	$(".apply_bg").fadeIn();
	$(".apply_form").fadeIn(1500);
});
				
	$("button.close_btn").click(function(){
	$(".apply_bg").fadeOut(1200);
	$(".apply_form").fadeOut(1200);
});
});

/*淡入淡出结束*/

/*表单验证*/

/*登录验证*/

var uname;
var upsw;

$(function(){
	
	$(":text#uname").focus(function(){
		$("p.checkUname").fadeOut();
	});
	
	$(":password#upsw").focus(function(){
		$("p.checkPsw").fadeOut();
	});
	
	$(":text#uname").blur(function(){
		uname = document.getElementById("uname").value;
		if(uname.length<=0){
			$("p.checkUname").fadeIn();
		}
	});
	
	$(":password#upsw").blur(function(){
		upsw = document.getElementById("upsw").value;
		if(upsw.length<6){
			$("p.checkPsw").fadeIn();
		}
	});
});

function check_login(){
	uname = document.getElementById("uname").value;
	upsw = document.getElementById("upsw").value;
	if(uname.length<=0){
			alert("用户名不能为空");
			return false;
		}
	if(upsw.length<6){
			alert("密码少于6位");
			return false;
		}
}
/*登录结束*/

/*个人中心表单验证*/

/*安全设置*/

var perPsw;
var perPsw2;
var formalPsw;

$(function(){
	
	$(":password#formalPsw").focus(function(){
		$("p.formal_text").fadeOut();
	});
	
	$(":password#perPsw").focus(function(){
		$("p.alert_text").fadeOut();
	});
	
	$(":password#perPsw2").focus(function(){
		$("p.alert_text2").fadeOut();
	});
	
	$(":password#formalPsw").blur(function(){
		formalPsw = document.getElementById("formalPsw").value;
		if(formalPsw.length <= 0){
			$("p.formal_text").fadeIn();
		}
	});
	
	$(":password#perPsw").blur(function(){
		perPsw = document.getElementById("perPsw").value;
		if(perPsw.length<6){
			$("p.alert_text").fadeIn();
		}
	});
	
	$(":password#perPsw2").blur(function(){
		perPsw2 = document.getElementById("perPsw2").value;
		if(perPsw != perPsw2){
			$("p.alert_text2").fadeIn();
		}
	});
	
});

function changePsw(){
		perPsw = document.getElementById("perPsw").value;
		formalPsw = document.getElementById("formalPsw").value;
		
		if(formalPsw.length <= 0){
			alert("请输入旧密码");
			return false;
		}
		
		if(perPsw.length <= 0){
			alert("新密码不能为空");
			return false;
		}
		
		if(perPsw.length<6){
			alert("新密码少于6位");
			return false;
		}
	
		perPsw2 = document.getElementById("perPsw2").value;
		if(perPsw != perPsw2){
			alert("两次输入的密码不一致");
			return false;
		}
}

/*安全设置验证结束*/

/*学生基本资料表单验证*/

function checkStuInfo(){
	
	var pername = document.getElementById("pername").value;
	var stunum = document.getElementById("stunum").value;
	var sex = document.getElementById("sex").value;
	var nation = document.getElementById("nation").value;
	var datepicker = document.getElementById("datepicker").value;
	var hometown = document.getElementById("hometown").value;
	var stature = document.getElementById("stature").value;
	var education = document.getElementById("education").value;
	var studyTime = document.getElementById("studyTime").value;
	var college = document.getElementById("college").value;
	var major = document.getElementById("major").value;
	var grade = document.getElementById("grade").value;
	var stuClass = document.getElementById("stuClass").value;
	var political_status = document.getElementById("political_status").value;
	var IDcard = document.getElementById("IDcard").value;
	var cashCard = document.getElementById("cashCard").value;
	var SCHcard = document.getElementById("SCHcard").value;
	
	if(pername.length <= 0){
		alert("姓名不能为空");
		return false;
	}
	
	if(stunum.length <= 0){
		alert("学号不能为空");
		return false;
	}
	
	if(sex == 0){
		alert("请选择性别");
		return false;
	}
	
	if(nation.length <= 0){
		alert("民族不能为空");
		return false;
	}
	
	if(datepicker.length <= 0){
		alert("请选择出生日期");
		return false;
	}
	
	if(hometown.length <= 0){
		alert("请填写籍贯");
		return false;
	}
	
	if(stature.length <= 0){
		alert("请填写身高");
		return false;
	}
	
	if(education == 0){
		alert("请选择学历");
		return false;
	}
	
	if(studyTime == 0){
		alert("请选择学制");
		return false;
	}
	
	if(college == 0){
		alert("请选择学院");
		return false;
	}
	
	if(major.length <= 0){
		alert("请填写专业");
		return false;
	}
	
	if(grade == 0){
		alert("请选择年级");
		return false;
	}
	
	if(stuClass.length <= 0){
		alert("请填写班级");
		return false;
	}
	
	if(political_status == 0){
		alert("请选择政治面貌");
		return false;
	}
	
	if(IDcard.length <= 0){
		alert("请填写身份证号");
		return false;
	}
	
	if(cashCard.length <= 0){
		alert("请填写银行卡号");
		return false;
	}
	
	if(SCHcard.length <= 0){
		alert("请填写校园卡号");
		return false;
	}
}
/*学生基本资料终于结束了！！！累死*/

/*学生联系方式*/
function checkContact(){
	var normalTel = document.getElementById("normalTel").value;
	var simpleTel = document.getElementById("simpleTel").value;
	
	if(normalTel.length <= 0){
		alert("长号是必须滴");
		return false;
	}
	if(simpleTel.length <= 0){
		alert("短号是必须滴");
		return false;
	}
}
/*学生联系方式结束*/

/*公司表单验证*/

function checkCompanyInfo(){
	
	var Name = document.getElementById("Name").value;
	var Code = document.getElementById("Code").value;
	var Type = document.getElementById("Type").value;
	var Industry = document.getElementById("Industry").value;
	var Intro = document.getElementById("Intro").value;
	var Tel = document.getElementById("Tel").value;
	var Linkman = document.getElementById("Linkman").value;
	var LinkTel = document.getElementById("LinkTel").value;
	var Adress = document.getElementById("Adress").value;
	
	if(Name.length <= 0){
		alert("请填写公司全称");
		return false;
	}
	
	if(Code.length <= 0){
		alert("请填写公司代码");
		return false;
	}
	
	if(Type.length <= 0){
		alert("请填写公司类型");
		return false;
	}
	
	if(Industry.length <= 0){
		alert("请填写所属行业");
		return false;
	}
	
	if(Intro.length <= 0){
		alert("请填写公司简介");
		return false;
	}
	
	if(Intro.length <= 20){
		alert("公司简介至少20字哦");
		return false;
	}
	
	if(Tel.length <= 0){
		alert("请填写公司联系电话");
		return false;
	}
	
	if(Linkman.length <= 0){
		alert("请填写公司联系人");
		return false;
	}
	
	if(LinkTel.length <= 0){
		alert("请填写公司联系人电话");
		return false;
	}
	
	if(Adress.length <= 0){
		alert("请填写公司详细地址");
		return false;
	}
}

/*公司部分结束*/

/*教师部分开始*/

function checkTecInfo(){

	var tecCollege = document.getElementById("tecCollege").value;
	var officeAdd = document.getElementById("officeAdd").value;
	var telTec = document.getElementById("telTec").value;
	var leaderTec = document.getElementById("leaderTec").value;
	var mobileTec = document.getElementById("mobileTec").value;
	
	if(tecCollege.length <= 0){
		alert("请填写学院");
		return false;
	}
	
	if(officeAdd.length <= 0){
		alert("请填写办公地址");
		return false;
	}
	
	if(telTec.length <= 0){
		alert("请填写办公电话");
		return false;
	}
	
	if(leaderTec.length <= 0){
		alert("请填写负责老师");
		return false;
	}
	
	if(mobileTec.length <= 0){
		alert("请填写老师电话");
		return false;
	}
}

/*岗位申请页面弹框开始*/
$(document).ready(function(){
	$("button.job_btn").click(function(){
		$(".apply_bg").fadeIn();
		$(".apply_form").fadeIn(300);
		});
		
	$("button.close_btn").click(function(){
		$(".apply_bg").fadeOut(200);
		$(".apply_form").fadeOut(200);
	});
});
/*岗位申请页面弹框结束*/

/*栏目子页面公用js开始*/

$(function(){
	$("ul.categorys > li:first").addClass("category_on");
	$("ul.categorys li").click(function(){
		$(this).parents("ul").find("li").removeClass("category_on");
		$(this).addClass("category_on");
	})
})

/*栏目子页面公用js结束*/


/*首页新闻轮播js开始*/
$(function(){
	$('#slides').slides({
		preload: true,
		preloadImage: 'img/loading.gif',
		play: 5000,
		pause: 2500,
		hoverPause: true,
		animationStart: function(){
			$('.caption').animate({
				bottom:-35
			},100);
		},
		animationComplete: function(current){
			$('.caption').animate({
				bottom:0
			},200);
			if (window.console && console.log) {
				// example return of current slide number
				console.log(current);
			};
		}
	});
});
/*首页新闻轮播js结束*/